﻿using System;
using System.Web.UI;
using EPiServer.UI;
using OpenWaves.EPiServer.GeoProperties;
using OpenWaves.Web;

[assembly: PublicAssemblyResources(AssemblyResources.ViewPortPageAssemblyResourceName)]

[assembly: WebResource(AssemblyResources.GeoViewPortControlAssemblyResourceName, "text/javascript")]

namespace OpenWaves.EPiServer.GeoProperties
{
    public static partial class AssemblyResources
    {
        public const string ViewPortPageAssemblyResourceName = "OpenWaves.EPiServer.GeoProperties.ViewPortPage.aspx";

        public const string GeoViewPortControlAssemblyResourceName =
            "OpenWaves.EPiServer.GeoProperties.Scripts.GeoViewPortControl.js";
    }

    public partial class ViewPortPage : ContentBaseSystemPage
    {                
        protected string LatitudeText
        {
            get { return Translate("latitudeText"); }
        }

        protected string LongitudeText
        {
            get { return Translate("longitudeText"); }
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            var resourceUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(ViewPortPage), AssemblyResources.GeoViewPortControlAssemblyResourceName);
            this.Page.ClientScript.RegisterClientScriptInclude("GeoViewPortControl", resourceUrl);
        }

        public override string Translate(string key)
        {
            return base.Translate(String.Format("/{0}/{1}", PropertyGeoRectangle.UniqueName, key));
        }
    }
}